var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r,
    s,
    c = cc._decorator,
    p = c.ccclass,
    l = c.property;
c.menu;
(function (t) {
    t[(t.LEFT = 0)] = "LEFT";
    t[(t.CENTER = 1)] = "CENTER";
    t[(t.RIGHT = 2)] = "RIGHT";
})(r || (r = {}));
(function (t) {
    t[(t.Up = 0)] = "Up";
    t[(t.CENTER = 1)] = "CENTER";
    t[(t.Down = 2)] = "Down";
})(s || (s = {}));
var d = (function (t) {
    i(e, t);
    function e() {
        var e = (null !== t && t.apply(this, arguments)) || this;
        e.leftringht = r.CENTER;
        e.updowm = s.CENTER;
        e.offectdisY = 0;
        e.PercentageY = 1;
        return e;
    }
    e.prototype.onLoad = function () {
        this.startSize = cc.v2(750, 1334);
        this.startReset();
    };
    e.prototype.startReset = function () {
        this.initposition || (this.initposition = this.node.convertToWorldSpaceAR(cc.Vec2.ZERO));
        var t = this.initposition,
            e = cc.winSize,
            o = cc.v2((e.width - this.startSize.x) / 2, (e.height - this.startSize.y) / 2);
        o.y = o.y - this.offectdisY * o.y;
        o.mulSelf(this.PercentageY);
        switch (this.updowm) {
            case s.Down:
                t.y = this.initposition.y - o.y;
                break;
            case s.Up:
                t.y = this.initposition.y + o.y;
                break;
            case s.CENTER:
        }
        switch (this.leftringht) {
            case r.LEFT:
                t.x = this.initposition.x - o.x;
                break;
            case r.RIGHT:
                t.x = this.initposition.x + o.x;
                break;
            case r.CENTER:
        }
        this.node.parent ? this.node.setPosition(this.node.parent.convertToNodeSpaceAR(t)) : this.node.setPosition(t);
    };
    n([l({type: cc.Enum(r), displayName: "左右适配模式", tooltip: ""})], e.prototype, "leftringht", void 0);
    n([l({type: cc.Enum(s), displayName: "上下适配模式", tooltip: ""})], e.prototype, "updowm", void 0);
    n([l({type: cc.Float, displayName: "额外偏移Y距离", tooltip: "额外偏移Y距离"})], e.prototype, "offectdisY", void 0);
    n([l({type: cc.Float, displayName: "适配的百分比", tooltip: "适配的百分比"})], e.prototype, "PercentageY", void 0);
    return n([p], e);
})(cc.Component);
o.default = d;
